package org.example.system.service;

import org.example.system.entity.Order;
import org.example.system.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;

    public int add(Order order) { return orderMapper.insert(order); }
    public int delete(Long id) { return orderMapper.deleteById(id); }
    public int update(Order order) { return orderMapper.update(order); }
    public Order findById(Long id) { return orderMapper.selectById(id); }
    public List<Order> findAll() { return orderMapper.selectAll(); }
    public List<Order> findByUsername(String username) { return orderMapper.selectByUsername(username); }
    public List<Order> findByCondition(String username, String product, String location, Integer quantity) {
        return orderMapper.selectByCondition(username, product, location, quantity);
    }
} 